<template>
    <div>
        {{msg}}
        {{name}}
        {{age}}

    </div>
</template>

<script>
import {login} from '@/http/apis'
export default {
    data () {
        return {
            msg:'',
            name:'',
            age:''
            
        }
    },
    methods: {
        //请求数据显示在页面
        init(){
            let params={
                name:'zhangsan',
                pwd:'1234'
            }
            login(params)
            .then(res=>{
                console.log(res)
                this.msg=res.msg
                this.name=res.data.name
                this.age=res.data.age
            })
            // this.axios.post('http://127.0.0.1:8000/user/login/',params)
            // .then(res=>{
            //     console.log(res)
            // })
            
            
        }
        
    },
    created() {
        this.init()
    },

}
</script>

<style>

</style>
